import * as React from 'react';
import {FunctionComponent,MouseEvent} from "react";

// const Button = ({onClick: handleClick, children}) => (
//   <button onClick={handleClick}>{children}</button>
// );

// 1. 添加一个类型  Props类型  onClick: 函数类型  参数 MouseEvent : React提供的 类型
type Props = { onClick(e:MouseEvent<HTMLElement>):void, }

const Button: FunctionComponent<Props> = ({onClick: handleClick, children}) => (
  <button onClick={handleClick}>{children}</button>
);

function handle(e) {
  console.log(e);
  console.log('我是按钮');
}

function FnTs(props) {
  return <div>
    <Button onClick={handle} children={'按钮啊'}/>
  </div>
}



export default FnTs;
